using Engine;
using Engine.Graphics;
using Game;

namespace SCIENEW {
    public class MetalLineItem : FlatItem, IMaterialBlock {
        public Materials Material;
        public Materials GetMaterial() => Material;
        public MetalLineItem(Materials type) : base(type + "Line") {
            Material = type;
            DisplayName = string.Format(LanguageControl.Get("Items", "Names", "MetalLineItem"), Material.ToDisplayName());
            DefaultTextureSlot = 212;
            Description = string.Format(LanguageControl.Get("Items", "Descriptions", "MetalLineItem"), Material.ToDisplayName());
            Color = MaterialsUtils.GetColor(type);
        }

        public override void DrawBlock(PrimitivesRenderer3D primitivesRenderer, int value, Color color, float size, ref Matrix matrix, DrawBlockEnvironmentData environmentData)
        {
            BlocksManager.DrawFlatBlock(primitivesRenderer, value, size, ref matrix, IndustrialModLoader.IETexture, Color, false, environmentData);
        }

        public override CraftingRecipe[] GenerateProceduralRecipe(int value) {
            //矿石到粉
            if (Material == Materials.None) return base.GenerateProceduralRecipe(value);
            CraftingRecipe craftingRecipe = new CraftingRecipe {
                Description = $"在压榨机把{Material.ToDisplayName()}棒压成丝",
                Ingredients = new string[36],
                RemainsValue = 0,
                RemainsCount = 0,
                RequiredHeatLevel = ComponentSqueezer.RequiredHeatLevel,
                RequiredPlayerLevel = 0,
                ResultValue = ItemsBlockManager.GetItemID(this),
                ResultCount = 4,
            };
            craftingRecipe.Ingredients[0] = IECraftingRecipesManager.BlockToIngredient(ItemsBlockManager.GetItemIdByMaterial<RodItem>(Material));
            return [craftingRecipe];
        }
    }
}